const app = getApp()
function tabbarinit() {
//创建tabbar
  return [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "/static/tabbar/index.png",
        "selectedIconPath": "/static/tabbar/index_on.png"
      },
      {
        "pagePath": "pages/index/t_class/stufent/homework/homework",
        "text": "作业",
        "iconPath": "/static/tabbar/作业本.png",
        "selectedIconPath": "/static/tabbar/作业本black.png"
      },
      {
        "pagePath": "pages/user/index",
        "text": "我的",
        "iconPath": "/static/tabbar/user.png",
        "selectedIconPath": "/static/tabbar/user_on.png"
      }
     ]
 }
 //tabbar 主入口
function tabbarmain(bindName = "tabdata", id, target) {
   var that = target;
   var bindData = {};
   var otabbar = tabbarinit();
   otabbar[id]['iconPath'] = otabbar[id]['selectedIconPath']//换当前的icon
   otabbar[id]['current'] = 1;
   bindData[bindName] = otabbar
   that.setData({ bindData });
 }
 //抛出组件
 module.exports = {
   tabbar: tabbarmain
 }
